/**
 * 文件描述如下：
 * 1. 设备驱动页面的数据
 */

const data_1 = {
  title: 'rscu',
  data: [
    {
      id: 0,
      key: 'ack',
      parentNode: 'rscu',
      name: '返回确认',
      showType: 'switch',
      inputType: 'switch',
    },
    {
      id: 1,
      key: 'coordinate',
      parentNode: 'rscu',
      name: '坐标系',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 2,
      key: 'cross-id',
      parentNode: 'rscu',
      name: '路口编号',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 3,
      key: 'cross-name',
      parentNode: 'rscu',
      name: '路口名称',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 4,
      key: 'cross-type',
      parentNode: 'rscu',
      name: '路口类型',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 5,
      key: 'elevation',
      parentNode: 'rscu',
      name: '海拔',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 6,
      key: 'icc-id',
      parentNode: 'rscu',
      name: '集成电路卡识别码',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 7,
      key: 'imei',
      parentNode: 'rscu',
      name: 'IMEI',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 8,
      key: 'latitude',
      parentNode: 'rscu',
      name: '经度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 9,
      key: 'link-id',
      parentNode: 'rscu',
      name: '路段编号',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 10,
      key: 'link-name',
      parentNode: 'rscu',
      name: '路段名称',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 11,
      key: 'longitude',
      parentNode: 'rscu',
      name: '纬度',
      showType: 'input',
      inputType: 'double',
    },
    {
      id: 12,
      key: 'owner',
      parentNode: 'rscu',
      name: 'rscu设备归属方',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 13,
      key: 'region-id',
      parentNode: 'rscu',
      name: '区域id',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 14,
      key: 'road-id',
      parentNode: 'rscu',
      name: '道路编号',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 15,
      key: 'road-name',
      parentNode: 'rscu',
      name: '道路名称',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 16,
      key: 'road-type',
      parentNode: 'rscu',
      name: '道路类型',
      showType: 'input',
      inputType: 'int',
    },
    {
      id: 17,
      key: 'sn',
      parentNode: 'rscu',
      name: 'sn编码',
      showType: 'input',
      inputType: 'text',
    },
    {
      id: 18,
      key: 'supplier',
      parentNode: 'rscu',
      name: 'rscu设备供应商',
      showType: 'input',
      inputType: 'text',
    },
  ],
}

const data_1_2 = {
  title: 'ptp',
  data: [
    {
      id: 0,
      key: 'ip',
      parentNode: 'ptp',
      name: 'ip',
      showType: 'input',
      inputType: 'ip',
    },
  ],
}
const data_2 = {
  title: 'rsu',
  data: [
    {
      id: 0,
      arr: [],
      key: 'rsu',
      parentNode: null,
      name: 'rsu',
      showType: 'arr',
      inputType: 'arr',
    },
  ],
}

const data_3 = {
  title: 'camera',
  data: [
    {
      id: 0,
      arr: [],
      key: 'camera',
      parentNode: null,
      name: 'camera',
      showType: 'arr',
      inputType: 'arr',
    },
  ],
}

const data_4 = {
  title: 'lidar',
  data: [
    {
      id: 0,
      arr: [],
      key: 'lidar',
      parentNode: null,
      name: 'lidar',
      showType: 'arr',
      inputType: 'arr',
    },
  ],
}

const data_5 = {
  title: 'radar',
  data: [
    {
      id: 0,
      arr: [],
      key: 'radar',
      parentNode: null,
      name: 'radar',
      showType: 'arr',
      inputType: 'arr',
    },
  ],
}

const data_6 = {
  title: 'trafficlight',
  data: [
    {
      id: 0,
      arr: [],
      key: 'trafficlight',
      parentNode: null,
      name: 'trafficlight',
      showType: 'arr',
      inputType: 'arr',
    },
  ],
}

export const dataProcessing_equipments = (params) => {
  if (!params) return
  // 头部的块
  data_1.data.forEach((item) => {
    item.value = params[item.parentNode][item.key]
  })
  data_1_2.data.forEach((item) => {
    item.value = params[item.parentNode][item.key]
  })

  data_2.data.forEach((item) => {
    item.arr = params[item.key]
  })

  data_3.data.forEach((item) => {
    item.arr = params[item.key]
  })

  data_4.data.forEach((item) => {
    item.arr = params[item.key]
  })

  data_5.data.forEach((item) => {
    item.arr = params[item.key]
  })

  data_6.data.forEach((item) => {
    item.arr = params[item.key]
  })

  return { data_1, data_1_2, data_2, data_3, data_4, data_5, data_6 }
}
